const express = require('express');
const router = express.Router();
const payController = require('../controllers/payController');
const { authenticateUserToken } = require('../middleware/jwtAuth');

// 引入限流中间件
const { paymentLimiter } = require('../middleware/rateLimitConfig');

// 创建支付订单（需要登录认证+限流保护）
router.post('/create', authenticateUserToken, paymentLimiter, payController.createOrder.bind(payController));

// 支付回调（不限流，微信服务器调用）
router.post('/notify', payController.notify.bind(payController));

// 查询支付结果
router.get('/query/:orderNo', payController.queryPayment.bind(payController));

module.exports = router;


